<?php
$page = new BUIControl();
$activeOperation = Blyn::app()->getActiveOperation();
if ($activeOperation instanceof BOperation) {
    $menuControl = new BUIWXMenu($activeOperation);
}
$menuName = $menuControl->getName();
$children = $menuControl->getChildren();
$childrenAsLeaf = $menuControl->getChildrenAsLeaf();
foreach ($children as $id => $child) {
    $wxMenu = new BUIWXMenu($activeOperation);
    $fullName = substr($child->getAttributeNode()->getFullName(),10);//含有.
    $fullName_replace = str_replace('.','|', $fullName);//含有|
    $menu = $wxMenu->getChild($fullName_replace);
    if($child->getChildren()){
       ?> 
        <p><a  class = "btn"><?php echo substr($child->getAttributeNode()->getFullName(),10).'<br/>'; ?></a> </p> 
 <?php   }  else { ?>
       <p><a href = "<?php echo $menu->getMenuUrl(); ?>" class = "btn" target="_blank"><?php echo substr($child->getAttributeNode()->getFullName(),10).'<br/>'; ?></a> </p> 
 <?php  }
 ?>                     
    <?php   $children2 = $child->getChildren();
                     foreach ($children2 as $id => $child) {
                          $wxMenu = new BUIWXMenu($activeOperation);
                          $fullName = substr($child->getAttributeNode()->getFullName(),10);//含有.
                          $fullName_replace = str_replace('.','|', $fullName);//含有|
                          $menu = $wxMenu->getChild($fullName_replace);
     ?>
<p><a href = "<?php echo $menu->getMenuUrl(); ?>" class = "btn" target="_blank"><?php echo $fullName_replace; ?></a> </p> 
                                              <?php         } ?>
                       
            <?php         } ?>


